//
//  MainViewController.m
//  SDSY
//
//  Created by 蓝布鲁 on 2017/3/17.
//  Copyright © 2017年 蓝布鲁. All rights reserved.
//

#import "MainViewController.h"
#import "HomeViewController.h"
#import "NewsViewController.h"
#import "SearchViewController.h"
#import "SettingsViewController.h"

@interface MainViewController ()

@end

@implementation MainViewController

#pragma mark - 初始化方法
-(instancetype)init{
    if (self==[super init]) {
        // 设置TabBar的字控制器
        [self setupViewControllers];
    }
    return self;
}

#pragma mark - 系统回调方法
- (void)viewDidLoad {
    [super viewDidLoad];
    
    // 修复黑影
    self.view.backgroundColor = UIColor.whiteColor;
}

#pragma mark - 自定义方法
/**
 * @brief 设置TabBar的字控制器
 */
- (void)setupViewControllers {
    // 1.设置首页控制器&导航控制器
    HomeViewController *homeViewController = [[HomeViewController alloc] init];
    UINavigationController *homeNavi = [[UINavigationController alloc] initWithRootViewController:homeViewController];
    [self addChildViewController:homeNavi];
    
    // 2.设置资讯控制器&导航控制器
    NewsViewController *newsViewController = [[NewsViewController alloc] init];
    UINavigationController *newsNavi = [[UINavigationController alloc] initWithRootViewController:newsViewController];
    [self addChildViewController:newsNavi];
    
    // 3.设置资讯控制器&导航控制器
    SearchViewController *searchViewController = [[SearchViewController alloc] init];
    UINavigationController *searchNavi = [[UINavigationController alloc] initWithRootViewController:searchViewController];
    [self addChildViewController:searchNavi];
    
    // 4.设置资讯控制器&导航控制器
    SettingsViewController *settingsViewController = [[SettingsViewController alloc] init];
    UINavigationController *settingsNavi = [[UINavigationController alloc] initWithRootViewController:settingsViewController];
    [self addChildViewController:settingsNavi];
}


@end
